package com.explorex.infra.puma.gateway.netty.common.utils;


import com.explorex.infra.puma.gateway.netty.ws.enums.MessageTypeEnum;
import com.explorex.infra.puma.gateway.netty.ws.message.Message;
import com.explorex.infra.puma.gateway.netty.ws.message.MessageHeader;

/**
 * @author: JacceYang
 * @createTime: 2022/11/17 18:27
 * @description:
 */
public class MessageBuilderUtils {


    public static Message buildSendMessage(String domain, int bizId, int contentType, long seqId, Object payload, int qos) {
        Message message = new Message();
        if (payload != null) {
            message.setBody(payload);

        }
        MessageHeader respHeader = new MessageHeader(MessageTypeEnum.MESSAGE_DOWN.getType());
        respHeader.setBizId(bizId);
        respHeader.setAppId(domain);
        respHeader.setSeq(seqId);
        respHeader.setQos(qos);
        respHeader.setContentType(1);
        message.setHeader(respHeader);

        return message;
    }
}
